using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.Suppliers
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("SupplierType")]
    [Route("api/basic-archives/supplier-type")]
    public partial class SupplierTypeController : BasicArchivesController, ISupplierTypeAppService
    {
        protected ISupplierTypeAppService SupplierTypeAppService => LazyServiceProvider.LazyGetRequiredService<ISupplierTypeAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<SupplierTypeDto> GetAsync(Guid id)
        {
            return SupplierTypeAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<SupplierTypeDto> FindAsync(string filter)
        {
            return SupplierTypeAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<SupplierTypeDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return SupplierTypeAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<SupplierTypeDto>> GetListAsync(FilterRequestDto input)
        {
            return SupplierTypeAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<SupplierTypeDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return SupplierTypeAppService.QueryAsync(input);
        }

        [HttpPost]
        [Route("get-children")]
        public Task<ListResultDto<SupplierTypeDto>> GetChildrenAsync(Guid? parentId, bool recursive = false)
        {
            return SupplierTypeAppService.GetChildrenAsync(parentId, recursive);
        }

        [HttpPost]
        public Task<SupplierTypeDto> CreateAsync(SupplierTypeCreateDto input)
        {
            return SupplierTypeAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<SupplierTypeDto> UpdateAsync(Guid id, SupplierTypeUpdateDto input)
        {
            return SupplierTypeAppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return SupplierTypeAppService.DeleteAsync(id);
        }
    }
}